Basic Authentication
The Entity, Integration, and Search APIs support authenticating via HTTP Basic Authentication. Basic authentication allows you to bundle your user credentials as part of the request without first having to get a session ID using a Login request.
To use basic authentication:
-
Create your Entity, Integration, or Search request as described in the respective topic.
-
Add a new header to your request and enter Authorization as the key.
-
Create a Base64 encoding of your username and password separated by a colon (e.g. cguser:cgpassword). In Windows, you can use PowerShell or Certutil.exe to quickly generate a Base64 string.
-
Using PowerShell: Open a PowerShell prompt and enter the following command, replacing username and password with the credentials of the ChangeGear user:
[convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes("username:password"))
-
Using Certutil.exe: Create a new text file and enter "username:password" as the only contents, replacing username and password with the credentials of the ChangeGear user. Open Command Prompt and enter the following command, replacing inFile with the path to the file you just created and outFile with the path to a new file containing the Base64-encoded string:
certutil -encode inFileoutFile
-
-
Enter Basic <Base64-encoded Credentials> in the Value field of the Authorization header created in step 2.
Using Basic Authentication, your authentication only lasts for the duration of a single session. If you plan on making multiple requests as the same user, we recommend using the Login API to generate a reusable session ID.